import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

const home = resolve => {
    require.ensure(['../pages/home.vue'], () => {
        resolve(require('../pages/home.vue'))
    })
}
const preview = resolve => {
    require.ensure(['../pages/preview.vue'], () => {
        resolve(require('../pages/preview.vue'))
    })
}
const table = resolve => {
    require.ensure(['../pages/table.vue'], () => {
        resolve(require('../pages/table.vue'))
    })
}
const websocket = resolve => {
    require.ensure(['../pages/websocket.vue'], () => {
        resolve(require('../pages/websocket.vue'))
    })
}
const mobile = resolve => {
    require.ensure(['../pages/mobile.vue'], () => {
        resolve(require('../pages/mobile.vue'))
    })
}
const chart = resolve => {
    require.ensure(['../pages/chart.vue'], () => {
        resolve(require('../pages/chart.vue'))
    })
}
const mobilePreview = resolve => {
    require.ensure(['../pages/mobilePreview.vue'], () => {
        resolve(require('../pages/mobilePreview.vue'))
    })
}
const payment = resolve => {
    require.ensure(['../pages/payment.vue'], () => {
        resolve(require('../pages/payment.vue'))
    })
}
const report = resolve => {
    require.ensure(['../pages/report.vue'], () => {
        resolve(require('../pages/report.vue'))
    })
}

let routes = [
    // {
    //     path: '/',
    //     redirect: '/home'
    // },
    {
        path: '/home',
        name: 'home',
        component: home
    },
    {
        path: '/preview',
        name: 'preview',
        component: preview
    },
    {
        path: '/report',
        name: 'report',
        component: report
    },
    {
        path: '/table',
        name: 'table',
        component: table
    },
    {
        path: '/websocket',
        name: 'websocket',
        component: websocket
    },
    {
        path: '/mobile',
        name: 'mobile',
        component: mobile
    },
    {
        path: '/chart',
        name: 'chart',
        component: chart
    },
    {
        path: '/mobilePreview',
        name: 'mobilePreview',
        component: mobilePreview
    },
    {
        path: '/payment',
        name: 'payment',
        component: payment
    }
]

export default new Router({
    routes
})
